{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 上传文件\n",
    "scp C:\\Users\\Administrator\\Desktop\\access.log  root@192.168.0.107:root\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\Users\\\\Administrator\\\\traning_python\\\\8800'"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 切换到Hadoop目录\n",
    "\n",
    "cd /usr/local/hadoop\n",
    "\n",
    "# 建立输入文件夹\n",
    "\n",
    "mkdir ./input\n",
    "\n",
    "# 准备输入文件\n",
    "cp root/access.log ./input\n",
    "\n",
    "# 统计access.log中“pay_type”次数\n",
    "\n",
    "./bin/hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples*.jar grep ./input ./output 'pay_type'\n",
    "\n",
    "\n",
    "# 查看结果\n",
    "\n",
    "cat ./output/*\n",
    "\n",
    "# 结果\n",
    "\n",
    "6    pay_type"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
